using System.Collections;
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;
using XFGameFramework.TweenSystem;


namespace XFGameFramework
{



    [CustomEditor(typeof(TweenAnimationSequence))]
    public class TweenAnimationSequenceInspector : Editor
    {
        private List<SerializedProperty> properties = null;

        private SerializedProperty mScript = null;

        private SerializedProperty loopMode = null;

        private void OnEnable()
        {
            properties = serializedObject.GetAllSerializedProperty();
            mScript = serializedObject.FindProperty("m_Script");
            loopMode = serializedObject.FindProperty("loopMode");
        }


        public override void OnInspectorGUI()
        {
            //base.OnInspectorGUI();

            EditorGUI.BeginDisabledGroup(true);
            EditorGUILayout.PropertyField(mScript);
            EditorGUI.EndDisabledGroup();

            foreach (var property in properties)
            {
                serializedObject.Update();

                if (property.name == "loopCount") 
                {
                    if ((LoopMode)loopMode.intValue == LoopMode.Once) 
                    {
                        continue;
                    }

                }

                EditorGUILayout.PropertyField(property);

                serializedObject.ApplyModifiedProperties();
            }

        }

    }

}

